package cn.cnsy123.blog.application.http.request;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

public class UserLoginRequest implements Serializable {

    @NotBlank(message = "请输入登录博客的用户名")
    @Pattern(regexp = "^[^\u4e00-\u9fa5]{0,}$",message = "用户名不能包含汉字")
    @Length(min = 4,max = 20,message = "用户名长度超出或者太小")
    @Pattern(regexp = "^[a-zA-Z][a-zA-Z0-9_]{3,19}$",message = "用户名不能包含除“_”外的符号或不能以数字开头")
    private String userName;

    @NotBlank(message = "请输入登录密码")
    @Length(min = 8,max = 20,message = "用户密码长度超出或者太小")
    @Pattern(regexp = "^[^\u4e00-\u9fa5]{0,}$",message = "密码不能包含汉字")
    @Pattern(regexp = "^[a-zA-Z]\\w{7,19}$",message = "密码只能以字母开始，长度在8-20位，只能包含字母、数字和下划线")
    private String passWord;


    @NotBlank(message = "请输入图形验证码")
    @Pattern(regexp = "^[^\u4e00-\u9fa5]{0,}$",message = "图形验证码不能包含汉字")
    @Pattern(regexp = "^[a-zA-Z0-9]{6}$",message = "图形验证码输入格式有误")
    private String imgCode;

    @NotBlank(message = "验证码已失效，请重新获取")
    private String cacheKey;


    public UserLoginRequest() {
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getImgCode() {
        return imgCode;
    }

    public void setImgCode(String imgCode) {
        this.imgCode = imgCode;
    }


    public String getCacheKey() {
        return cacheKey;
    }

    public void setCacheKey(String cacheKey) {
        this.cacheKey = cacheKey;
    }
}
